;(function () { 
	var vuePullLoading = {} 
	vuePullLoading.install = function (Vue,options) { 
		Vue.directive('pull-loading', { 
			update: function (value) {
				
				this.callBack = value;			
				this.loadOk =false;
				this.curDom = this.el;	//当前元素
				this.windowTop = window.innerHeight;//获取窗口高度
				this.targetTop= document.getElementById('box');
				var self = this;
								
				this.curDom.addEventListener('touchend',function(e){
					self.touchEnd(e);
				},false);	
															
			}, 			
			touchEnd:function(e){
				
				var box =e.currentTarget;
				var targetTop =box.lastElementChild.getBoundingClientRect().top.toFixed(0);	//获取底部元素
				if(targetTop < this.windowTop ){
					this.callBack();				
				}else{
					return false;
				}								
			}		
			
		});
	} 
	if (typeof exports == "object") {
		module.exports = vuePullLoading;
	} else if (typeof define == "function" && define.amd) {
		define([], function(){ 
			return vuePullLoading ;
		})
	} else if (window.Vue) { 
		window.vuePullLoading = vuePullLoading;
		Vue.use(vuePullLoading);
	}
})();
